package com.larry.mr2.partition2;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class CustomPartition extends Partitioner<Text,FlowBean> {
    @Override
    public int getPartition(Text text, FlowBean flowBean, int numPartitions) {

        int part = 5;
        String phone = text.toString();
        if (phone.startsWith("136")){
            part = 0;
        }else if (phone.startsWith("137")){
            part = 1;
        } else if (phone.startsWith("138")) {
            part = 2;
        }else if (phone.startsWith("139")){
            part = 3;
        }else {
            part = 4;
        }

        return part;
    }
}
